package android_codebehind;

import java.util.ArrayList;
import common.GUIColor;
import android_fields.*;
import dk.dtu.compute.course02312.matadorfinal.R;

/**
 * Creates all the fields
 * @author Daniel og Ronnie
 */
public final class GUIFieldFactory {
	
	// 75% > 40 so increase in capacity is required
	private static ArrayList<AndroidField> fields = new ArrayList<AndroidField>(54);
	
	public static ArrayList<AndroidField> createFieldsFromArrayList(
		ArrayList<AndroidField> fieldsInArrayList) {
		if(fields.isEmpty()) {
			fields = fieldsInArrayList;
		}
		return fields;
	}
	public ArrayList<AndroidField> makeTestFields() {
		if(fields.isEmpty()) {
			
			AndroidField start1 = new GUIStart.Builder().build();
			fields.add(start1);
			
			AndroidField start2 = new GUIStart.Builder()
				.setBgColor(GUIColor.MAGENTA)
				.setFgColor(GUIColor.BLUE)
				.setTitle("Begin")
				.setSubText("Get money")
				.setDescription("Collecting...\nWait for it!")
				.build();
			fields.add(start2);
			
			AndroidField tax1 = new GUITax.Builder().build();
			fields.add(tax1);
			
			AndroidField tax2 = new GUITax.Builder()
				.setBgColor(GUIColor.GRAY)
				.setFgColor(GUIColor.BLACK)
				.setTitle("Betal skat\nBetal skat\nBetal skat\nBetal skat\nBetal skat")
				.setSubText("2000 kr.")
				.setDescription("Skattefelt")
				.build();
			fields.add(tax2);
			
			AndroidField refuge1 = new GUIRefuge.Builder().build();
			fields.add(refuge1);
			
			AndroidField refuge2 = new GUIRefuge.Builder()
				.setBgColor(GUIColor.YELLOW)
				.setFgColor(GUIColor.BLACK)
				.setTitle("Refuge is here!")
				.setSubText("Get 5000")
				.setDescription("This is a refuge")
				.setPictureId(R.drawable.building_3house)
				.build();
			fields.add(refuge2);
			
			AndroidField jail1 = new GUIJail.Builder().build();
			fields.add(jail1);
			
			AndroidField jail2 = new GUIJail.Builder()
				.setBgColor(GUIColor.YELLOW)
				.setFgColor(GUIColor.BLACK)
				.setSubText("Go to Jail")
				.setDescription("This is a go to jail field.")
				.setPictureId(R.drawable.field_go_to_jail)
				.build();
			fields.add(jail2);
			
			AndroidField chance1 = new GUIChance.Builder().build();
			fields.add(chance1);
			
			AndroidField chance2 = new GUIChance.Builder()
				.setBgColor(GUIColor.YELLOW)
				.setFgColor(GUIColor.BLACK)
				.setTitle("Go To Jail is here!")
				.setSubText("Go to Jail")
				.setDescription("This is a go to jail field.")
				.build();
			fields.add(chance2);
			
			AndroidField street1 = new GUIStreet.Builder().build();
			fields.add(street1);
			
			AndroidField street2 = new GUIStreet.Builder()
				.setBgColor(GUIColor.YELLOW)
				.setFgColor(GUIColor.BLACK)
				.setTitle("Go To Jail is here!")
				.setSubText("Go to Jail")
				.setDescription("This is a go to jail field.")
				.build();
			fields.add(street2);
		}
		
		return fields;
	}
	
	public ArrayList<AndroidField> makeDefaultFields() {
		if(fields.isEmpty()) {
			
			fields.add(new GUIStart.Builder().build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Rødovrevej")
				.setBgColor(new GUIColor(75, 155, 255))
				.setSubText("kr. 1200")
				.setDescription("Rødovrevej")
				.setRent("$ 50")
				.build());
			
			fields.add(new GUIChance.Builder().build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Hvidovrevej")
				.setBgColor(new GUIColor(75, 155, 255))
				.setSubText("kr. 1200")
				.setDescription("Hvidovrevej")
				.setRent("kr. 50")
				.build());
			
			fields.add(new GUITax.Builder()
				.setTitle("Betal indkomstskat")
				.setSubText("10% el. kr.4000")
				.setDescription("Betal indkomstskat\n10% eller kr. 4000,-")
				.build());
			
			fields.add(new GUIShipping.Builder()
				.setTitle("Scanlines")
				.setSubText("kr. 4000")
				.setDescription("Scanlines\nHelsingør-Helsingborg")
				.setPictureId(R.drawable.field_ferry1)
				.setRent("kr. 500")
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Roskildevej")
				.setBgColor(new GUIColor(255, 110, 10))
				.setSubText("kr. 2000")
				.setDescription("Roskildevej")
				.setRent("kr. 100")
				.build());
			
			fields.add(new GUIChance.Builder().build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Valby\nLanggade")
				.setBgColor(new GUIColor(255, 110, 10))
				.setSubText("kr. 2000")
				.setDescription("ValbyLanggade")
				.setRent("kr. 100")
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Allégade")
				.setBgColor(new GUIColor(255, 110, 10))
				.setSubText("kr. 2400")
				.setDescription("Allégade")
				.setRent("kr. 150")
				.build());
			
			fields.add(new GUIJail.Builder()
				// .setPictureId(R.drawable.field_jail)
				.setSubText("På besøg")
				.setDescription("På besøg i fængslet")
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Frederiksberg\nAllé")
				.setBgColor(new GUIColor(152, 204, 50))
				.setSubText("kr. 2800")
				.setDescription("Frederiksberg Allé")
				.setRent("kr. 200")
				.build());
			
			fields.add(new GUIBrewery.Builder()
				.setTitle("Tuborg")
				.setPictureId(R.drawable.field_brewery1)
				.setDescription("Tuborg bryggeri")
				.setRent("100 x terningeslag")
				.setSubText("kr. 3000")
				.setFgColor(GUIColor.WHITE)
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Bülowsvej")
				.setBgColor(new GUIColor(152, 204, 50))
				.setSubText("kr. 2800")
				.setDescription("Bülowsvej")
				.setRent("kr. 200")
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Gl. Kongevej")
				.setBgColor(new GUIColor(152, 204, 50))
				.setSubText("kr. 3200")
				.setDescription("Gammel kongevej")
				.setRent("kr. 250")
				.build());
			
			fields.add(new GUIShipping.Builder()
				.setTitle("Mols-linie")
				.setSubText("kr. 4000")
				.setDescription("Mols-linien\nEn genvej i Danmark")
				.setPictureId(R.drawable.field_ferry2)
				.setRent("kr. 500")
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Bernstorffs-\nvej")
				.setBgColor(new GUIColor(153, 153, 153))
				.setSubText("kr. 3600")
				.setDescription("Bernstorffsvej")
				.setRent("kr. 300")
				.build());
			
			fields.add(new GUIChance.Builder().build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Hellerupvej")
				.setBgColor(new GUIColor(153, 153, 153))
				.setSubText("kr. 3600")
				.setDescription("Hellerupvej")
				.setRent("kr. 300")
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Strandvejen")
				.setBgColor(new GUIColor(153, 153, 153))
				.setSubText("kr. 4000")
				.setDescription("Strandvejen")
				.setRent("kr. 350")
				.build());
			
			fields.add(new GUIRefuge.Builder()
				.setTitle("Parkering")
				.setSubText("Parkering")
				.setDescription("Modtag kr. 5000")
				.setBgColor(new GUIColor(110, 220, 255))
				.setPictureId(R.drawable.field_parking)
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Trianglen")
				.setBgColor(new GUIColor(255, 0, 0))
				.setSubText("kr. 4400")
				.setDescription("Trianglen")
				.setRent("kr. 350")
				.build());
			
			fields.add(new GUIChance.Builder().build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Østerbrogade")
				.setBgColor(new GUIColor(255, 0, 0))
				.setSubText("kr. 4400")
				.setDescription("Østerbrogade")
				.setRent("kr. 350")
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Grønningen")
				.setBgColor(new GUIColor(255, 0, 0))
				.setSubText("kr. 4800")
				.setDescription("Grønningen")
				.setRent("kr. 400")
				.build());
			
			fields.add(new GUIShipping.Builder()
				.setTitle("Scanlines")
				.setSubText("kr. 4000")
				.setDescription("Scanlines\nGedser-Rostock")
				.setPictureId(R.drawable.field_ferry3)
				.setRent("kr. 500")
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Bredgade")
				.setBgColor(new GUIColor(255, 255, 255))
				.setSubText("kr. 5200")
				.setDescription("Bredgade")
				.setRent("kr. 450")
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Kgs. Nytorv")
				.setBgColor(new GUIColor(255, 255, 255))
				.setSubText("kr. 5200")
				.setDescription("Kongens Nytorv")
				.setRent("kr. 450")
				.build());
			
			fields.add(new GUIBrewery.Builder()
				.setTitle("Carlsberg")
				.setPictureId(R.drawable.field_brewery2)
				.setDescription("Carlsberg bryggeri")
				.setRent("100 x terningeslag")
				.setSubText("kr. 3000")
				.setFgColor(GUIColor.WHITE)
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Østergade")
				.setBgColor(new GUIColor(255, 255, 255))
				.setSubText("kr. 5600")
				.setDescription("Østergade")
				.setRent("kr. 500")
				.build());
			
			fields.add(new GUIJail.Builder()
				.setPictureId(R.drawable.field_go_to_jail)
				.setSubText("Gå i fængsel")
				.setDescription("De fængsles\nSlå to ens for at komme ud")
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Amagertorv")
				.setBgColor(new GUIColor(255, 255, 50))
				.setSubText("kr. 6000")
				.setDescription("Amagertorv")
				.setRent("kr. 550")
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Vimmelskaftet")
				.setBgColor(new GUIColor(255, 255, 50))
				.setSubText("kr. 6000")
				.setDescription("Vimmelskaftet")
				.setRent("kr. 550")
				.build());
			
			fields.add(new GUIChance.Builder().build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Nygade")
				.setBgColor(new GUIColor(255, 255, 50))
				.setSubText("kr. 6400")
				.setDescription("Nygade")
				.setRent("kr. 600")
				.build());
			
			fields.add(new GUIShipping.Builder()
				.setTitle("Scanlines")
				.setSubText("kr. 4000")
				.setDescription("Scanlines\nRødby-Puttgarden")
				.setPictureId(R.drawable.field_ferry4)
				.setRent("kr. 500")
				.build());
			
			fields.add(new GUIChance.Builder().build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Frederiks-\nberggade")
				.setBgColor(new GUIColor(150, 60, 150))
				.setFgColor(GUIColor.WHITE)
				.setSubText("kr. 7000")
				.setDescription("Frederiksberggade")
				.setRent("kr. 700")
				.build());
			
			fields.add(new GUITax.Builder()
				.setTitle("Ekstra-\nordinær\nstatsskat:")
				.setSubText("kr.2000")
				.setDescription("Betal Ekstraordinærstatsskat\nkr. 2000,-")
				.build());
			
			fields.add(new GUIStreet.Builder()
				.setTitle("Rådhus-\npladsen")
				.setBgColor(new GUIColor(150, 60, 150))
				.setFgColor(GUIColor.WHITE)
				.setSubText("kr. 8000")
				.setDescription("Rådhuspladsen")
				.setRent("kr. 1000")
				.build());
		}
		
		return fields;
	}
}
